<template>
    <div ref="body">
        <Form :label-width="120" inline>
            <Form-item label="申请人名称:">
                <Input v-model="queryParam.azcp0003" placeholder="请输入申请人名称" style="width:180px"/>
            </Form-item>
            <Form-item label="申请人证件号:">
                <Input v-model="queryParam.azcp0001" placeholder="请输入申请人证件号" style="width:180px"/>
            </Form-item>
            <Form-item label="保障类型:">
                <c-dict-select v-model="queryParam.ssca0002" dictCode="assistancetype" style="width:180px"
                               showKeys="100,101,102,200,201,202,203,500"/>
            </Form-item>
            <Form-item label="业务类型:">
                <c-dict-select v-model="queryParam.ssca0016" dictCode="handletype" style="width:180px"
                               showKeys="100,200,204,212,213,214,215,216,217,300,500,501"/>
            </Form-item>
            <Form-item label="处理状态:">
                <c-dict-select v-model="queryParam.state" dictCode="pull_state" style="width:180px"/>
            </Form-item>
            <Form-item label="处理结果:">
                <c-dict-select v-model="queryParam.result" dictCode="pull_result" style="width:180px"/>
            </Form-item>
            <Row class="button_row">
                <span style="float: left;">
                 <Button type="primary" @click="handleException">处理异常</Button>
                </span>
                <span style="float: right;">
                 <Button type="primary" @click="searchQuery">查询</Button>
                 <Button type="primary" class="button_item_left" @click="searchReset">重置</Button>
                </span>
            </Row>
        </Form>

        <div class="table_div">
            <vxe-table border
                       resizable
                       row-id="id"
                       :row-key="true"
                       show-overflow="tooltip"
                       highlight-hover-row
                       align="center"
                       header-align="center"
                       ref="xTree"
                       :loading="Loading"
                       :data="tableData">

                <vxe-table-column field="azcp0003" title="申请人姓名" align="center" width="140" fixed="left"/>
                <vxe-table-column field="azcp0001" title="申请人证件号码" align="center" width="160" fixed="left"/>
                <vxe-table-column field="ssca0002_name" title="保障类型" align="center" width="140" />
                <vxe-table-column field="ssca0016_name" title="业务类型" align="center" width="110" />
                <vxe-table-column field="azaa0002" title="属地区划" align="center" width="200" />
                <vxe-table-column field="processname" title="业务流程" align="center" width="200"/>
                <vxe-table-column field="create_date" title="业务受理时间" align="center" width="160"
                                  :formatter="renderDetailTime"/>
                <vxe-table-column field="nodename" title="当前任务" align="center" width="140"/>
                <vxe-table-column field="optime" title="任务办理时间" align="center" width="160"
                                  :formatter="renderDetailTime"/>
                <vxe-table-column field="opusername" title="办理人" align="center" width="140"/>
                <vxe-table-column field="state_name" title="处理状态" align="center" width="100" fixed="right"/>
                <vxe-table-column field="result_name" title="处理结果" align="center" width="100" fixed="right"/>
                <vxe-table-column field="count" title="处理次数" align="center" width="100" fixed="right"/>
                <vxe-table-column field="" title="操作" min-width="100" fixed="right">
                    <template v-slot="{ row }">
                        <Button type="default" @click="searchDetail(row)" v-if="row.count>0">查看详情</Button>
                    </template>
                </vxe-table-column>
            </vxe-table>
            <Page :total="dataCount" :page-size="pageSize" show-total class="paging"
                  @on-change="handleTableChange" :current="pageNo"></Page>
        </div>
        <detail ref="modal"/>
    </div>
</template>

<script>
    import {CommonMixin} from '@/views/common/js/CommonMixin'
    import detail from './modules/detail'
    import {postAction} from '@/api/request'

    export default {
        name: "ss00009list",
        components: {detail},
        mixins: [CommonMixin],
        data() {
            return {
                queryParam: {},
                Loading: false,
                url: {
                    list: "/api/ac/subsistence/ss00029ServiceImpl/page",
                    handle:"/api/ac/subsistence/ss00029ServiceImpl/updateHandleExceptionDate",
                },
            }
        },
        methods: {
            searchDetail(row) {
                var width = this.$refs.body.clientWidth;
                this.$refs.modal.load(row);
                this.$refs.modal.width = width + 40;
                this.$refs.modal.key = this.uuid();
            },
          handleException: function () {
                let that = this
                let url = that.url.handle
                let dataParam = {}
                that.Loading=true;
                postAction(url, dataParam).then((res) => {
                  if (res.data.errcode != 0) {
                    that.$Message.error(res.data.errmsg)
                  } else {
                    that.$Message.success(res.data.data.msg)
                  }
                }).finally(() => {
                    that.Loading=false;
                    that.loadData();
                    }
                )
          },
        },
        created() {
            this.loadData();
        }
    }
</script>

<style scoped>

</style>
